//index.js
const uri = require('../../utils/uriConfig.js');
//获取应用实例
const app = getApp()

Page({
  data: {
    swiperList: [],
    huayuList: [],
    loadHuayu:true,
    newsList: [
      {
        src: 'http://img.cssandjs.top/1522740315371_795860.png',
        title: '朋友过生日，送什么样的花束最合适，这篇文章告诉你'
      },
      {
        src: 'http://img.cssandjs.top/1522740315371_795860.png',
        title: '测试111'
      }
    ]
  },
  onLoad: function () {
    const _this = this;
    wx.request({
      url: uri.swiperList,
      method: 'POST',
      data: {
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded' // 默认值
      },
      success(res) {
        if (res.data) {
          _this.setData({
            swiperList: res.data
          })
        }
      }
    })
    wx.request({
      url: uri.flowerList,
      method: 'POST',
      data: {
      },
      header: {
        'content-type': 'application/x-www-form-urlencoded' // 默认值
      },
      success(res) {
        if (res.data) {
          _this.setData({
            huayuList: res.data,
            loadHuayu: false
          })
        }
      },
      fail(err){
        console.log(err, '-------------------------')
      }
    })
  },
  showDesc(event){
    const desc = event.currentTarget.dataset.desc;
    wx.showModal({
      title: '',
      content: desc,
      showCancel: false
    })
  },
  /**
  * 生命周期函数--监听页面显示
  */
  onShow: function () {
    if (typeof this.getTabBar === 'function' &&
      this.getTabBar()) {
      this.getTabBar().setData({
        selected: 0
      })
    }
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})
